#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	string b;
	cin>>a>>b;
	int c = 0, t = 1;
	for(int i = b.size()-1;i >= 0;i--){
		if(b[i] >= 'a')
			c += (b[i]-'a'+10)*t;
		else
			c += (b[i]-'0')*t;
		t *= 16;
	}
	c += a;
	
	string ans;
	while(c){
		if(c%16 < 10)
			ans += c%16+'0';
		else
			ans += c%16-10+'a';
		c /= 16;
	}
	reverse(ans.begin(), ans.end());;
	cout<<ans;
	return 0;
}
